#ifndef KOZ_TYPES_H
#define KOZ_TYPES_H

// KeyOnZip(8Zip) types

const kVer8z = 1;
const int kMaxKeys8z = 4;
const unsigned int kIsEncrypted8z = 0x00000001;
const wchar_t kGetPassword8z[32] = L"N8Z::GetPassowrd::";

#define COMMON_HEADER unsigned int nCmd; unsigned int handle; unsigned int ver

struct CommonHeader
{
  COMMON_HEADER;
};

struct CKeyItem
{
  char userid[64];
  char keyname[32];
  int keylen;
  char keyinfo[256];
};

struct KeyInfo8zAPI
{
  COMMON_HEADER;
  unsigned int job;
  unsigned int key_no;
  CKeyItem keys[kMaxKeys8z];

  KeyInfo8zAPI() 
  {
    memset((char *)this, 0, sizeof (*this));
  };
};

struct CMyProperty
{
  unsigned int crc; 
  unsigned int flags;
  unsigned int key_no;
  CKeyItem keys[4];

  CMyProperty()
  {
    memset((char *)this, 0, sizeof (*this));
  }
};

static unsigned int GetRealMyPropertySize(const CMyProperty x) 
{
  // return the size of a CMyProperty excluding that for the unused key(s).
  unsigned int headerSize=(sizeof x.crc)+(sizeof x.flags)+(sizeof x.key_no);
  return headerSize+x.key_no*(sizeof CKeyItem);
}

#endif //!KOZ_TYPES_H